package com.garbagecan.cachestudy.ehcache;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Element;

public class MemCacheExample {
	private static Log log = LogFactory.getLog(MemCacheExample.class);
	public static void main(String[]args) {
		CacheManager cacheManager = new CacheManager();
		Cache cache = new Cache("myCache", 1000, false, false, 5, 2);
		cacheManager.addCache(cache);
		
		cache.put(new Element("key1", "value1"));
		cache.put(new Element("key2", "value2"));
		
		Element ele = null;
		ele = cache.get("key1");
		log.info(ele);
		
		ele = cache.get("key2");
		log.info(ele);
		
		cacheManager.shutdown();
	}
}
